package com.cloud.cmt.usermanage.service.impl;

import com.angela.cloud.common.base.ResultMessage;
import com.cloud.cmt.usermanage.entity.Organization;
import com.cloud.cmt.usermanage.service.OrganizationRepository;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * User: wcy
 * Date: 2017/11/12
 * Time: 15:02
 */
@Service
public class OrgServiceImpl {
    @Resource
    OrganizationRepository organizationRepository;
    public List<Organization> getOrgTree(Long uplink){
        List<Organization> organizations = organizationRepository.findByUplink(uplink);
        for(Organization org:organizations){
            org.setChildren(getOrgTree(org.getId()));
        }
        return organizations;
    }
}
